window.onload=function(){
//	heixian();
//	$(".wrf_ding2_1").on("click", qiehuan);
//	$("#citys").hide();
//	$(".wrf_ding2_1_button").on("click", show_daohang);
//	$(".yanxue_keke").on("click", show_yanxue);
}
$(function() {
	onload_daohang();
	onload_dibu();
	onload_style();
	onload_thing();
//	$("head").append('<link rel="stylesheet" type="text/css" href="../../../css/pc/comment_daohang.css" />');
//	$("head").append('<link rel="stylesheet" type="text/css" href="../../../css/pc/ofs/pc_dibu.css" />');
});

function showCity() {
	$("#citys").show();
}

function hideCity(m) {
	$('#citys').hide();
	$(".wrf_guojia_quanguo").text($(m).text());
}

function heixian() {
	/*1.读取input  3
	2.获取ding2_1的数组,便利
	3.改制*/
	var number = $("#ding_input").val() - 1;
	var arr_ding2_1 = $(".wrf_ding2_1");
//	alert(arr_ding2_1);
	for(var i = 0; i < arr_ding2_1.length; i++) {
//		alert(number);
		if(i == number) {
			$(arr_ding2_1[i]).css("color", "black");
			if(window.innerWidth) {
				winWidth = window.innerWidth;
				if(winWidth <= 768) {

				} else {
					$(arr_ding2_1[i]).css("border-bottom-width", "3px");
					break;
				}
			}
		}
	}
}

function qiehuan() {
	$(".wrf_ding2_1").css("border-bottom-width", "0px");
	$(".wrf_ding2_1").css("color", "white");
	$(this).css("color", "black");
	if(window.innerWidth) {
		winWidth = window.innerWidth;
		if(winWidth <= 768) {

		} else {
			$(this).css("border-bottom-width", "3px");
		}
	} else if((document.body) && (document.body.clientWidth)) {
		winWidth = document.body.clientWidth;
		alert("2" + winWidth);
	}
}

function show_daohang() {
	$(".wrf_ding2_1").show();

}
$(document).click(function(e) {
	if(window.innerWidth) {
		winWidth = window.innerWidth;
		if(winWidth <= 768) {
			var _con = $('.wrf_ding2'); // 设置目标区域
			if(!_con.is(e.target) && _con.has(e.target).length === 0) { // Mark 1
				$('.wrf_ding2_1').hide();
			}
		}
	} else if((document.body) && (document.body.clientWidth)) {
		winWidth = document.body.clientWidth;
//		alert("2" + winWidth);
	}
});
$(document).click(function(e) {
	var _con = $('.yanxue_keke'); // 设置目标区域
	if(!_con.is(e.target) && _con.has(e.target).length === 0) { // Mark 1
		$('.wrf_ding_menu').hide();
	}

});

function show_yanxue() {
	$(".wrf_ding_menu").show();
}
/* Mark 1 的原理：
判断点击事件发生在区域外的条件是：
1. 点击事件的对象不是目标区域本身
2. 事件对象同时也不是目标区域的子元素
*/
function onload_daohang() {
		$.ajax({
					url: "./../../../static/pc_daohang.html",
//					url:"D:/myinstallsoft/HBuilder/workspace/inquirylearning/static/daohang.html",
					type: "get",
					success: function(result) {
						$(".wrf_ding").append(result);
//						alert("123456");
					}
	});
}
function onload_style() {
		$.ajax({
					url: "./../../../static/comment_daohang.css",
//					url:"D:/myinstallsoft/HBuilder/workspace/inquirylearning/static/daohang.html",
					type: "get",
					success: function(result) {
						$(".wrf_ding").append("<style>"+result+"</style>");
//						alert("123456");
					}
	});
		$.ajax({
					url: "./../../../static/pc_dibu.css",
//					url:"D:/myinstallsoft/HBuilder/workspace/inquirylearning/static/daohang.html",
					type: "get",
					success: function(result) {
						$(".wrf_ding").append("<style>"+result+"</style>");
//						alert("123456");
					}
	});
}
function onload_dibu() {
		$.ajax({
					url: "./../../../static/pc_dibu.html",
//					url:"D:/myinstallsoft/HBuilder/workspace/inquirylearning/static/daohang.html",
					type: "get",
					success: function(result) {
						$(".foot").append(result);
//						alert("123456");
					}
	});
}
function onload_thing() {
		$.ajax({
					url: "./../../../static/dingbu_shijan.html",
//					url:"D:/myinstallsoft/HBuilder/workspace/inquirylearning/static/daohang.html",
					type: "get",
					success: function(result) {
						$("body").append("<script>"+result+"</script>");
//						alert("123456");
					}
	});
}
